#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
struct node
{
	LL a, b;
	int id;
}S[N];
int n;

bool cmp(node A, node B)
{
	LL x = A.a * (B.b);
	LL y = B.a * (A.b);
	if (x == y)return A.id < B.id;
	else return x > y;

}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		LL a, b;
		scanf("%lld%lld", &a, &b);
		//double ans = (a * 1.0) / (a + b);
		S[i] = { a,(a + b),i };
	}
	sort(S + 1, S + n + 1, cmp);
	for (int i = 1; i <= n; i++) {
		printf("%d ", S[i].id);
	}
	return 0;
}